using System.IO;
using System.Web;
using Newtonsoft.Json;

namespace OpenWaves.ActivityFeed.Web.Handler
{
    public static class HttpResponseBaseExtensions
    {
        public static T DeserializeBody<T>(this HttpResponseBase response)
        {
            var serializer = JsonSerializer.Create(JsonNetSerializerSettings.Current);
            return serializer.Deserialize<T>(new JsonTextReader(new StreamReader(response.OutputStream, response.ContentEncoding)));
        }
    }
}